package com.mec.web.y2012.ajax;

import java.io.BufferedReader;

import javax.servlet.http.HttpServletRequest;

import org.apache.log4j.Logger;

public class AjaxUtil {
	
	public static String readStringFromRequest(HttpServletRequest request){
		
		StringBuffer retval = new StringBuffer();
		//
		String line = null;
		try{
			BufferedReader reader = request.getReader();
			while(null != (line = reader.readLine())){
				retval.append(line);
			}
		}catch(Exception e){
			logger.error("Error reading JSON String:", e);
		}
		
		return retval.toString();
	}
	
	private static final Logger logger = 
			Logger.getLogger(AjaxUtil.class);

}
